package cn.pconline.autoclub.entity;

import cn.pconline.autoclub.util.EncodeUtils;
import com.alibaba.fastjson.JSONObject;
import java.util.Date;
import org.gelivable.dao.Column;
import org.gelivable.dao.Entity;
import org.gelivable.dao.Id;

/**
 *
 * @author chensy
 */
@Entity(tableName = "ac_club_notice",logChange = true)
public class ClubNotice {

    @Id
    @Column(name = "club_id")
    private long clubId;//车友会Id
    @Column(name = "content")
    private String content;//公告内容
    @Column(name = "update_by")
    private long updateBy;//更新者ID
    @Column(name = "update_at")
    private Date updateAt;//更新时间
    public final static int STATUS_NOT_AUDITED = 0;
    public final static int STATUS_AUDITED = 1;
    public final static int STATUS_DELETE = 2;
    @Column(name = "status")
    private int status;//状态，0未审1已审2删除

    public long getClubId() {
        return clubId;
    }

    public void setClubId(long clubId) {
        this.clubId = clubId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public long getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(long updateBy) {
        this.updateBy = updateBy;
    }

    public Date getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Date updateAt) {
        this.updateAt = updateAt;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
    
    public JSONObject toJson(){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("content", getContent());
        jsonObject.put("stauts", getStatus());                
        return jsonObject;        
    }    
    
    public JSONObject toJsonEncodeHTML(){
        JSONObject jsonObject = toJson();
        jsonObject.put("content", EncodeUtils.encodeForHTMLFilterNull(getContent()));      
        return jsonObject;
    }      
}
